package com.me.Utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016101500688935";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCDBhZpyQh3g10Vj/LDpA7OpSi232uLutZjmIHj6NBWeon81YC6aC2Lj/7+Zi7kMHJCfdTbSwmNmNvPZiT/5dKnVU4VvWtWqHaqzv2+zWPZZ3gvLhJxO2Vd/jAjhw5OrrSiZlT+WkwoTuYjrPvgYIZshtqEjXYJ0qvcrnX5RGZ9ilw9YA3/eXglGS54qUURTs0cSjdbY2IZzqdgq5z2G0GAe5HWUfcNExq/NZTl+i7QlY4C9fJnq6G7N5yVshWdBi2JVpaEroGILcqOrNFqSzXG15SrgDHSMueE9J0MKXqy+C6Q/MfEmVpVg/LMCb5k9cb8Nn2MeLUchMjetJbDNyTRAgMBAAECggEAdyRv+R2vL04qtNLCxBhIxqv0i+Y520O4c7RYWLB50kl3dIuIlPjqgYAdNaQhe6p6G/BkQEzJkRKwvrV5a6DGnxa4/JfUJWbnEYdLwdbutuCZrv1ME98Y3BGqIIRNBEtlQk+fdfMSUYz9RO+l0nCzi7hMuEASV/hUA0Y5TMNgF0MC2zjOwQ2CDcPgTU0tRLZhMz0SLEqA0dvcPa3xxvLNpY3N5GtUo5FcTkZ93tBP8q0Ran0tkCGuURMMNLIRIolLaIZksCck3izgAqZR94w0vyNPs1Na3Pl1H7LQHU6LC2Sjo69s44SijfJklcsKpKv0PjGtzTdnsbzNm9Zwu/JZYQKBgQDuMk9MZ/G+apsqJevvDu4b+mIFrd/uroaWYTeMMBIuXazjtGdhHMf51L9pr/eJ7mWhPd1VilrAFPWWVPejz+1DhGdC/LHbSkFZp4axlYGnSv2EbIwEepLMCA5A4mMF9GTY4TT3BRM40GbpiPSryKmaPaVkaaVJEX9WriORpZ36NQKBgQCM0R4Qg4T/S/abQMkhLkpLWdhLNK4esnEU5n6O2673AYa/B+wB4MTIyUCMfsMZKjJQGztODKHlplrqwK4MOu/53NtEwpcNBklOL9TSFDenrULXZuqzLcQzIGvqSpVNf7aOKC9130NMLsYP/QU+zmi2Mtx60TOkgFO5ycuNG7qzrQKBgDV5k/XqTApcspMGym3z4x7i2ki+HUzfX5W5I5hUXnCMVTkVkjPqGzcKPSLD/4W2wJgvZFZE5lTDH9NtJd9f2btTqT8Prfo2NG+lPYb2spHVMw8cs156CiTGFjUY3fRDRrSt8o8WU5doqgH53jwGo5TeDBh740CBLh5On+udy9aVAoGAPxoWlt/Y4W5w+/F0L+JGeK2yN0FMJYVhFzSS0gGvzhBpCYHLSKwogrFss4i6dLRsB2mskbUnd3mslDXzyJdAon9N4uowNi3y+46DmABnUERcB5qe4dxIZ4DH2x3A+hGZBOsNGY0K40CykMeZaiOk2MDB/Gdy9OxsmHzNMlaSu6ECgYAp1iQ9tdHjdpyyMf9xJDgVobK/vhdAsSX3CzOyCbSisO8ycn2U+ZBueoPM7ORepqC/j0J3GQmlx9Dan4GuklaGk1fBHB9hSj/HqF3ati3kxyvAtnGE4YuAHLwSZlkLYWKqWNsgRQdjaPbSjG/5DtxhyDhy4Zk4W6x3i8dNTkxq6Q==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAucUoFbbvyZ1s6btrMiBXFfqIkID6AKv+XGks0WPuYNO0ptIWxnGqkpdZEfljYNJEPpDR2pGqbUoc8rgSpbSs7bCM6DDYZ5AdYBdZ32omCu1le8g2kDKuLgKiCANfoh35aBTFoqLZHx/z0p0joSuBj13LQwomtowcd00zDBZTKP3AZXcAdqwfq6nyzdD4L/vak7us52dwG+Hf+BAEe9Jp47LeCIIZKKLEA50UmbmjDDrhrhzYWRA4AoaUe9EjWraYGwogPar9vbbslJhVgr+uQTCNWihNBjLRudo3XRld9dZty2F+nIcTt2hlx/CTDvlMlAyaV7+tqVceStxN++sFAQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://127.0.0.1:8080/error.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://127.0.0.1:8080/order/paysuccess";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\Temp\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

